package com.maiji.cloud.controller.login;

import com.maiji.cloud.controller.BaseController;
import com.maiji.cloud.entities.login.*;
import com.maiji.cloud.request.BaseDataReqDto;
import com.maiji.cloud.request.login.MaijiArticleReqData;
import com.maiji.cloud.response.BaseDataResDto;
import com.maiji.cloud.response.BaseMetaResDto;
import com.maiji.cloud.response.BaseResDto;
import com.maiji.cloud.response.login.MaijiArticleResData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/common/")
@Api(tags = {"公用模块"})
public class CommonController extends BaseController {

    /**
     * 根据标签来源获取标签列表
     * @param baseDataReqDto
     * @return
     */
    @PostMapping("findAllLabelsBySource")
    public BaseDataResDto<List<Label>> findAllLabelBySource (@RequestBody BaseDataReqDto<Label> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/common/findAllLabelsBySource", baseDataReqDto, BaseDataResDto.class);
    }

    /**
     * 获取标签列表
     * @param baseDataReqDto
     * @return
     */
    @PostMapping("findAllLabels")
    public BaseMetaResDto<List<Label>> findAllLabels (@RequestBody BaseDataReqDto<Label> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/common/findAllLabels", baseDataReqDto, BaseMetaResDto.class);
    }

    /**
     * 添加标签
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation(value = "添加/编辑标签")
    @PostMapping("addEditLabel")
    public BaseDataResDto<Label> addEditLabel (@RequestBody BaseDataReqDto<Label> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/common/addEditLabel", baseDataReqDto, BaseDataResDto.class);
    }

    /**
     * 获取用户反馈列表
     * @param baseDataReqDto
     * @return
     */
    @PostMapping("findAllAdviceFeedbacks")
    public BaseMetaResDto<List<AdviceFeedbackEntity>> findAllAdviceFeedbacks (@RequestBody BaseDataReqDto<AdviceFeedbackEntity> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/feedback/findAllAdviceFeedbacks", baseDataReqDto, BaseMetaResDto.class);
    }

    /**
     * 客服回复用户反馈
     * @param baseDataReqDto
     * @return
     */
    @PostMapping("replyAdviceFeedback")
    public BaseResDto replyAdviceFeedback (@RequestBody BaseDataReqDto<AdviceFeedbackEntity> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/feedback/replyAdviceFeedback", baseDataReqDto, BaseResDto.class);
    }

    /**
     * 获取轮播图等
     * @return
     */
    @ApiOperation(value = "获取轮播图等")
    @PostMapping("findAllFunctionMemus")
    public BaseDataResDto<List<FunctionMemu>> findAllFunctionMemus (@RequestBody BaseDataReqDto<List<String>> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/common/findAllFunctionMemus", baseDataReqDto, BaseDataResDto.class);
    }

    /**
     * 编辑轮播图等
     * @param baseDataReqDto
     * @return
     */
    @ApiOperation(value = "编辑轮播图等")
    @PostMapping("editFunctionMemu")
    public BaseResDto editFunctionMemu (@RequestBody BaseDataReqDto<FunctionMemu> baseDataReqDto) {
        return restTemplate.postForObject(REST_URL_APPLOGIN + "/common/editFunctionMemu", baseDataReqDto, BaseResDto.class);
    }

}
